package com.sprucetec.live.service;

import com.sprucetec.live.common.dto.PagedListDTO;
import com.sprucetec.live.common.dto.RedisCacheDto;
import com.sprucetec.live.common.dto.business.LiveChatDto;
import com.sprucetec.live.common.dto.business.LiveVideoDto;
import com.sprucetec.live.entity.LiveVideo;

import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * @ClassName RedisService
 * @Description:
 * @Author Kenny
 * @Date 2020/4/1
 **/
public interface RedisService {

    /**
     * set value into redis
     *
     * @param key
     * @param value
     * @param timeUnit
     * @param timeout
     */
    void set(String key, Object value, TimeUnit timeUnit, long timeout);

    /**
     * get value from redis
     *
     * @param key
     * @return
     */
    Object get(String key);

    /**
     * 用户关闭窗口
     *
     * @param liveVideoDto
     */
    void videoDetailAway(LiveVideoDto liveVideoDto);


    /**
     * 直播详情相关数据统计
     *
     * @param liveVideoDto
     */
    void videoDetailData(LiveVideoDto liveVideoDto);

    /**
     * 后置处理改变视频时， 修改Redis缓存数据
     *
     * @param liveVideo
     */
    void videoChangeRefreshCache(LiveVideo liveVideo);


    /**
     * Mq 告知保存聊天人数聊天次数
     *
     * @param liveChatDto
     */
    void chatDataOnVideo(LiveChatDto liveChatDto);

    /**
     * 分页获取系统中所有Redis缓存
     *
     * @param redisCacheDto
     * @return
     */
    PagedListDTO<RedisCacheDto> getRedisCachePage(RedisCacheDto redisCacheDto);

    /**
     * 删除指定缓存
     *
     * @param redisCacheDto
     * @return
     */
    Integer deleteCache(RedisCacheDto redisCacheDto);

    Integer clearRedis(RedisCacheDto redisCacheDto);
}
